package com.pmp.dao;

import com.pmp.pojo.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by think on 2017/1/2.
 */
@Repository("userDao")
public interface UserDao{

    @Select(" SELECT * from user WHERE password = #{1} and username = #{0}")
    public User login(String username,String password);


    @Insert("insert user(user_id,username,password,sex,email,name) values(#{user.userId},#{user.username},#{user.password},#{user.sex},#{user.email},#{user.name})")
    public int insert(@Param("user") User user);

    @Select(" SELECT * from user")
    public List<User> queryUser();

    @Insert("insert pro_info(id,title,content) values(#{proInfo.id},#{proInfo.title},#{proInfo.content})")
    public int insertProInfo(@Param("proInfo") ProInfo proInfo);

    @Insert("insert pro_info_file(id,pId,path) values(#{proInfoFile.id},#{proInfoFile.pId},#{proInfoFile.path})")
    public int insertProInfoFile(@Param("proInfoFile") ProInfoFile proInfoFile);
}
